package com.kexun.service.impl;

import com.kexun.dao.AdmDao;
import com.kexun.dao.impl.AdmDaoImpl;
import com.kexun.pojo.*;
import com.kexun.service.AdmService;

import java.util.List;
import java.util.Map;

public class AdmServiceImpl implements AdmService {
    AdmDao ad = new AdmDaoImpl();
    /**
     * ajax实现填充数据
     *
     * @param userNum
     * @return
     */
    @Override
    public User findInfo(String userNum) {
        User user = ad.findInfo(userNum);
        return user;

    }

    /**
     * 修改用户信息
     *
     * @param user
     * @return
     */
    @Override
    public int updateAdm(User user) {
        int i = ad.updateAdm(user);
        return i;
    }

    /**
     * 课程信息查看
     *
     * @param limitStr
     * @param pageStr
     * @return
     */
    @Override
    public Map<String, Object> findAllCos(String limitStr, String pageStr) {
        Map<String, Object> map = ad.finAllCos(limitStr, pageStr);
        return map;
    }

    /**
     * 课程管理——添加课程信息
     *
     * @param course
     * @return
     */
    @Override
    public int addCourse(Course course) {
        int i = ad.addCourse(course);
        return i;
    }

    /**
     * 修改课程信息
     *
     * @param course
     * @return
     */
    @Override
    public int editCos(Course course) {
        int i  = ad.editCos(course);
        return i;
    }

    /**
     * 删除学生信息
     * @param couName
     * @return
     */
    @Override
    public int delCouse(String couName) {
        int i = ad.delCouse(couName);
        return  i ;
    }

    @Override
    public List<Course> findAllCourse() {
        List<Course> list = ad.finAllCourse();
        return list;
    }

    /**
     * 查找一个课程的信息
     *
     * @param userNum
     * @return
     */
    @Override
    public Map<String, Object> finOneCourse(String userNum) {
        Map<String,Object> map = ad.finOneCourse(userNum);
        return map;

    }

    @Override
    public Map<String, Object> findScoreAll(int limit, int page) {
        Map<String,Object> map = ad.finScoreAll(limit,page);
        return map;

    }

    @Override
    public Map<String, Object> findTeaInfoAll(int limit, int page) {
        Map<String,Object> map = ad.findTeaInfoAll(limit,page);
        return map;
    }

    @Override
    public Teacher findTeacher(String teaNum) {
        Teacher teacher = ad.findTeacher(teaNum);
        return teacher;
    }

    @Override
    public int editTeacher(Teacher teacher) {
        int  i = ad.editTeacher(teacher);
        return i;
    }

    @Override
    public int delTea(String teaNum) {
        int i = ad.delTea(teaNum);
        return i;
    }

    @Override
    public int addTeacher(User user, Teacher teacher) {
        int i = ad.addTeacher(user,teacher);
        return i;

    }

    @Override
    public Course findCouse(String couName) {
        Course cou = ad.findCouse(couName);
        return cou;
    }

    @Override
    public Score findScore(String stuNum,String courseName) {
        Score score = ad.findScore(stuNum,courseName);
        return score;
    }

    @Override
    public int editSco(Score score) {
        int i = ad.editSco(score);
        return i;
    }

    @Override
    public int delSco(String stuNum) {
        int i =ad.delSco(stuNum);
        return i;
    }

    @Override
    public int addScore(Score score) {
        int i = ad.addScore(score);
        return i;
    }

    @Override
    public Map<String, Object> allStuSco(String limit, String page) {
        Map<String,Object> map = ad.allStuSco(limit,page);
        return map;
    }

    @Override
    public Map<String,Object> findScoreLike(String courseName, String stuNum, String stuName, String stuClass, String major, String limitStr, String pageStr) {
        Map<String,Object> map  = ad.findScoreLike(courseName,stuNum,stuName,stuClass,major,limitStr,pageStr);
        return map;
    }

    @Override
    public Map<String, Object> findStudentAll(String limitStr, String pageStr) {
        Map<String,Object> map = ad.findStudentAll(limitStr,pageStr);
        return map;
    }

    @Override
    public Student findStudent(String stuNum, String stuName, String stuClass) {
        Student student = ad.finStudent(stuNum,stuName,stuClass);
        return student;

    }

    @Override
    public int editStu(Student student) {
        int i = ad.editStu(student);
        return i;
    }

    @Override
    public int delStu(String stuNum, String stuName, String stuClass) {
        int i = ad.delStu(stuNum,stuName,stuClass);
        return i;
    }

    @Override
    public int addStudent(User user, Student student) {
        int i = ad.addStudent(user,student);
        return i;
    }

    @Override
    public Map<String, Object> findUserAll(String limitStr, String pageStr) {
        Map<String,Object> map = ad.findUsrAll(limitStr,pageStr);
        return map;
    }

    @Override
    public Usert findUer(String userNum) {
        Usert user = ad.findUser(userNum);
        return user;
    }

    @Override
    public int editUsr(User user) {
        int i = ad.editUsr(user);
        return i;
    }

    @Override
    public int addUser(Usert user) {
        int i = ad.addUser(user);
        return i;
    }


}
